//package com.navinfo.opentsp.platform.computing.serializer;
//
//import com.mapbar.protobuf.entity.VehicleRTTopic_pb;
//import org.apache.flume.Context;
//import org.apache.flume.Event;
//import org.apache.flume.serialization.EventSerializer;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//
//import java.io.IOException;
//import java.io.OutputStream;
//
///**
// * @author gx
// */
//public class HdfsVehicleElectroCar implements EventSerializer {
//
//    private static final Logger logger = LoggerFactory.getLogger(HdfsVehicleElectroCar.class);
//    private final String APPEND_NEWLINE = "appendNewline";
//    private final boolean appendNewline;
//    private final OutputStream out;
//    private HdfsVehicleElectroCar(OutputStream out, Context ctx){
//        this.appendNewline = ctx.getBoolean(APPEND_NEWLINE, true);
//        this.out = out;
//    }
//
//    @Override
//    public void afterCreate() throws IOException {
//
//    }
//
//    @Override
//    public void afterReopen() throws IOException {
//
//    }
//
//    @Override
//    public void write(Event event) throws IOException {
//        try{
//            byte[] body = event.getBody();
////            VehicleRTTopic_pb.VehicleRTTopic_model.parseFrom(body);
//            this.out.write(body);
//            if (this.appendNewline) {
//                this.out.write(10);
//            }
//        } catch(Exception e){
//            logger.error("执行HDFS的HDFSVehicleElectroCar序列化器失败", e);
//        }
//    }
//
//    @Override
//    public void flush() throws IOException {
//        this.out.flush();
//    }
//
//    @Override
//    public void beforeClose() throws IOException {
//
//    }
//
//    @Override
//    public boolean supportsReopen() {
//        return false;
//    }
//
//    public static class Builder implements EventSerializer.Builder {
//        public Builder() {}
//        @Override
//        public EventSerializer build(Context context, OutputStream out) {
//            return  new HdfsVehicleElectroCar(out, context);
//        }
//    }
//}
